/*
 * Copyright 2009 XueSong Guo.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cn.webwheel.di;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 用来表明注入服务的注释接口。<br>
 * 此注入可放到类公开构造方法，类公开属性和类公开方法之上。<br>
 * 当使用此注释的类在DI容器中创建时，则这个类必然有一个所使用的注入静态参数，
 * 则当这个注入静态参数与此注释的value属性匹配时，标志此注释的地点才会进行注入。
 * 标记{@link cn.webwheel.di.Desire}注释的地点自动拥有了默认的注入服务，也就是
 * 为所有的注入静态参数提供注入服务。
 */
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Serve {

    /**
     * 注入服务的正则表达式模板数组，默认为“.*”，也就是匹配所有的注入需求。
     * @return 正则表达式模板数组
     */
    String[] value() default ".*";
}
